import os
# -------------------------- 项目根目录计算 --------------------------
# 当前文件（constant.py）所在路径 → config目录
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
# 项目根目录：config目录的父目录（即.env文件所在的根目录）
PROJECT_ROOT = os.path.dirname(CURRENT_DIR)
# -------------------------- 核心目录路径 --------------------------
# 数据目录（存储YAML测试数据）
DATA_DIR = os.path.join(PROJECT_ROOT, "data")
# 测试用例目录
TESTS_DIR = os.path.join(PROJECT_ROOT, "tests")
# 测试报告目录
REPORTS_DIR = os.path.join(PROJECT_ROOT, "reports")
REPORTS_TEMP_DIR = os.path.join(REPORTS_DIR, "temp")  # allure临时报告目录
ALLURE_REPORT_DIR = os.path.join(REPORTS_DIR, "allure-report")  # 最终allure报告目录
# 日志目录
LOGS_DIR = os.path.join(PROJECT_ROOT, "logs")
# 配置文件目录（当前目录，即config）
CONFIG_DIR = CURRENT_DIR
# -------------------------- 多环境.env文件路径（核心修改） --------------------------
# 1. 获取环境标识：优先读取系统环境变量APP_ENV，默认用dev（开发环境）
APP_ENV = os.getenv("APP_ENV", "dev")
# 2. 根目录下的.env文件路径：格式为 ".env.{环境标识}"（如.env.test、.env.prod）
ENV_FILE_PATH = os.path.join(PROJECT_ROOT, f".env.{APP_ENV}")
# 3. 兜底检查：若对应环境的.env文件不存在，提示错误（避免加载失败）
if not os.path.exists(ENV_FILE_PATH):
    raise FileNotFoundError(
        f"未找到{APP_ENV}环境的.env文件！请在根目录创建.env.{APP_ENV}（如.env.dev），当前路径：{ENV_FILE_PATH}"
    )
# -------------------------- 测试文件路径 --------------------------
# 龙果支付核心测试文件
TEST_LG_PATH = os.path.join(TESTS_DIR, "test_Dragon_Fruit_Payment.py")
# -------------------------- YAML测试数据文件路径 --------------------------
# 账户查询
ACCOUNT_INQUIRY_YAML_PATH = os.path.join(DATA_DIR, "account_inquiry.yaml")
ACCOUNT_INQUIRY_YAML_PATHS = ACCOUNT_INQUIRY_YAML_PATH  # 兼容冗余调用
# 用户管理
USER_MANAGEMENT_QUERY_YAML_PATHS = os.path.join(DATA_DIR, "user_management_query.yaml")
USER_MANAGEMENT_ADD_YAML_PATHS = os.path.join(DATA_DIR, "user_management_add.yaml")
# 结算管理
SETTLEMENT_MANAGEMENT_INQUIRY_YAML_PATHS = os.path.join(DATA_DIR, "Settlement_Management_Inquiry.yaml")
SETTLEMENT_MANAGEMENT_AND_SETTLEMENT_YAML_PATHS = os.path.join(DATA_DIR, "Settlement_management_and_settlement.yaml")
SETTLEMENT_MANAGEMENT_REVIEW_YAML_PATHS = os.path.join(DATA_DIR, "Settlement_management_review.yaml")
# 支付管理
PAYMENT_YAML_PATH = os.path.join(DATA_DIR, "Payment.yaml")
MODIFY_YAML_PATH = os.path.join(DATA_DIR, "modify.yaml")
BIND_A_CARD_NUMBER_YAML_PATH = os.path.join(DATA_DIR, "bind_a_card_number.yaml")
# 权限管理
PERMISSION_YAML_PATH = os.path.join(DATA_DIR, "permission.yaml")
PERMISSION_ADD_PERMISSION_YAML_PATH = os.path.join(DATA_DIR, "permission_add_permission.yaml")
PERMISSION_DELETE_PERMISSION_YAML_PATH = os.path.join(DATA_DIR, "permission_delete_permission.yaml")
# 对账管理
RECONCILIATION_YAML_PATH = os.path.join(DATA_DIR, "reconciliation.yaml")
# 接口路径配置
PATH_YAML_PATH = os.path.join(DATA_DIR, "path.yaml")